package game.metalmax.controller
{
	import showtime.framework.mvc.patterns.facade.Facade;
	
	/**
	 * @project Client
	 * @date 2011-7-5
	 * @author 绿豆蛙
	 * 
	 */
	public final class ApplicationFacade extends Facade
	{
		/**
		 * 启动MVC框架。
		 */		
		public static const STARTUP:String = "STARTUP";
		/**
		 * 关闭MVC框架。 
		 */		
		public static const SHUTDOWN:String = "SHUTDOWN";
	
		/**
		 * 构造函数。 
		 * 
		 */		
		public function ApplicationFacade()
		{
			
		}
		
		static public function getInstance():ApplicationFacade
		{
			if (instance == null)
			{
				instance = new ApplicationFacade();
			}
			
			return ApplicationFacade(instance);
		}
		
		public function startup(application:*):void
		{
			sendNotification(STARTUP, application);
		}

		override protected function initializeController():void
		{
			super.initializeController();
			
			registerCommand(SHUTDOWN, ShutdownCommand);
			registerCommand(STARTUP, StartupCommand);
		}
	}
}